<%@page import="java.util.List,java.util.ArrayList,com.kamus.model.Kosakata,com.kamus.manager.KosakataManager,java.util.Iterator;" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Kosakata List Inodensia - Gaul</title>
    </head>
    <form action="KosakataServlet" method="POST">
        <body>
            <h1>List Kosakata Indonesia - Gaul</h1>
            <table border="1">
                <tr>
                    <td></td>
                    <td>ID</td>
                    <td>Gaul</td>
                    <td>Indonesia</td>
                </tr>

                <%
                            List<Kosakata> list = new ArrayList<Kosakata>();
                            list = KosakataManager.getInstance().getKatas();
                            Kosakata kata = null;
                            for (Iterator<Kosakata> it = list.iterator(); it.hasNext();) {
                                kata = it.next();
                %>
                <tr>
                    <td><input type="checkbox" name="item" value="<%=kata.getId()%>"/></td>
                    <td><%=kata.getId()%></td>
                    <td><%=kata.getGaul()%></td>
                    <td><%=kata.getIndonesia()%></td>
                </tr>
                <%
                            }
                %>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>
                        <input type="hidden" name="action" value="delete"/>
                        <input type="submit" value="Ubah"/>
                        <input type="submit" value="Hapus"/>
                    </td>
                </tr>
            </table>
    </form>

    <br>
    <br>

    <form action="KosakataServlet" method="POST">
        <input type="hidden" name="action" value="tambah"/>
        <table>
            <tr>
                <td>Bahasa Gaul</td>
                <td><input type="text" name="gaul"/></td>
            </tr>
            <tr>
                <td>Bahasa Indonesia</td>
                <td><input type="text" name="indonesia"/></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="Tambah" /></td>
            </tr>
        </table>
    </form>
</body>
</html>
